const Merge = require('webpack-merge');
const CommonConfig = require('./webpack.config.js');
const HtmlWebPackPlugin = require('html-webpack-plugin');

const publicPath = './';
const ver = new Date().getFullYear() + ''+ (new Date().getMonth() + 1) + new Date().getDate() ;
module.exports = Merge(CommonConfig, {
    devServer: {
        contentBase: __dirname + "/app/public/", //本地服务器所加载的页面所在的目录
        compress: true,
        progress: true, //让编译的输出内容带有进度和颜色
        host: '0.0.0.0',
        port: 8081,
        hot: true,
        // allowedHosts: [ // 允许哪些域名访问devServer
        //     'y.qq.com'
        // ],
        compress: false // 服务器返回浏览器的时候是否启动gzip压缩
    },
    plugins: [
        new HtmlWebPackPlugin({
            template: './app/index.tmpl.html',
            filename: './index.html',
            publicPath,
            ver,
            hash: true,
        })
    ]
})